﻿
using System.Data;
using System.Data.SqlClient;

namespace BLL.Services
{
    public static class StoredProcedures
    {
        public static partial class Administrators
        {

            public static SqlCommand GetByLogin(SqlConnection conn, string @login)
            {
                var cmd = new SqlCommand("administrators_get_by_login", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Administrators
            {
                public const string GetByLogin = "administrators_get_by_login";
            }
        }
        public static partial class Administrators
        {

            public static SqlCommand Insert(SqlConnection conn, string @login, object @password, object @salt)
            {
                var cmd = new SqlCommand("administrators_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Administrators
            {
                public const string Insert = "administrators_insert";
            }
        }
        public static partial class Administrators
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("administrators_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Administrators
            {
                public const string SelectAll = "administrators_select_all";
            }
        }
        public static partial class Administrators
        {

            public static SqlCommand Update(SqlConnection conn, string @login, object @password, object @salt)
            {
                var cmd = new SqlCommand("administrators_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Administrators
            {
                public const string Update = "administrators_update";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand Delete(SqlConnection conn, int? @authorId)
            {
                var cmd = new SqlCommand("authors_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@authorId", SqlDbType.Int) { Value = @authorId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string Delete = "authors_delete";
            }
        }
        public static partial class Authors
        {

            /// <summary>
            /// Other parameters: @authorsIds: list_author
            /// </summary>
            public static SqlCommand GetByIds(SqlConnection conn)
            {
                var cmd = new SqlCommand("authors_get_by_ids", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string GetByIds = "authors_get_by_ids";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand GetByLetter(SqlConnection conn, string @letter)
            {
                var cmd = new SqlCommand("authors_get_by_letter", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@letter", SqlDbType.NVarChar) { Value = @letter });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string GetByLetter = "authors_get_by_letter";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand GetId(SqlConnection conn, string @firstName, string @lastName, string @middleName)
            {
                var cmd = new SqlCommand("authors_get_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@firstName", SqlDbType.NVarChar) { Value = @firstName });
                cmd.Parameters.Add(new SqlParameter("@lastName", SqlDbType.NVarChar) { Value = @lastName });
                cmd.Parameters.Add(new SqlParameter("@middleName", SqlDbType.NVarChar) { Value = @middleName });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string GetId = "authors_get_id";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand GetListing(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, string @firstName, string @lastName)
            {
                var cmd = new SqlCommand("authors_get_listing", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@firstName", SqlDbType.NVarChar) { Value = @firstName });
                cmd.Parameters.Add(new SqlParameter("@lastName", SqlDbType.NVarChar) { Value = @lastName });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string GetListing = "authors_get_listing";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand Insert(SqlConnection conn, string @lastName, string @firstName, string @middleName)
            {
                var cmd = new SqlCommand("authors_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@lastName", SqlDbType.NVarChar) { Value = @lastName });
                cmd.Parameters.Add(new SqlParameter("@firstName", SqlDbType.NVarChar) { Value = @firstName });
                cmd.Parameters.Add(new SqlParameter("@middleName", SqlDbType.NVarChar) { Value = @middleName });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string Insert = "authors_insert";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("authors_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string SelectAll = "authors_select_all";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand SelectById(SqlConnection conn, int? @authorId)
            {
                var cmd = new SqlCommand("authors_select_by_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@authorId", SqlDbType.Int) { Value = @authorId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string SelectById = "authors_select_by_id";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand Update(SqlConnection conn, int? @authorId, string @lastName, string @firstName, string @middleName)
            {
                var cmd = new SqlCommand("authors_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@authorId", SqlDbType.Int) { Value = @authorId });
                cmd.Parameters.Add(new SqlParameter("@lastName", SqlDbType.NVarChar) { Value = @lastName });
                cmd.Parameters.Add(new SqlParameter("@firstName", SqlDbType.NVarChar) { Value = @firstName });
                cmd.Parameters.Add(new SqlParameter("@middleName", SqlDbType.NVarChar) { Value = @middleName });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string Update = "authors_update";
            }
        }
        public static partial class Authors
        {

            public static SqlCommand Validate(SqlConnection conn, int? @authorId, string @firstName, string @lastName, string @middleName)
            {
                var cmd = new SqlCommand("authors_validate", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@authorId", SqlDbType.Int) { Value = @authorId });
                cmd.Parameters.Add(new SqlParameter("@firstName", SqlDbType.NVarChar) { Value = @firstName });
                cmd.Parameters.Add(new SqlParameter("@lastName", SqlDbType.NVarChar) { Value = @lastName });
                cmd.Parameters.Add(new SqlParameter("@middleName", SqlDbType.NVarChar) { Value = @middleName });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Authors
            {
                public const string Validate = "authors_validate";
            }
        }
        public static partial class Auto
        {

            public static SqlCommand AdministratorsDelete(SqlConnection conn, string @login)
            {
                var cmd = new SqlCommand("auto_Administrators_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Auto
            {
                public const string AdministratorsDelete = "auto_Administrators_delete";
            }
        }
        public static partial class AutoComplete
        {

            public static SqlCommand GetAuthors(SqlConnection conn, string @searchPattern)
            {
                var cmd = new SqlCommand("autoComplete_get_authors", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@searchPattern", SqlDbType.NVarChar) { Value = @searchPattern });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class AutoComplete
            {
                public const string GetAuthors = "autoComplete_get_authors";
            }
        }
        public static partial class AutoComplete
        {

            public static SqlCommand GetBooks(SqlConnection conn, string @searchPattern)
            {
                var cmd = new SqlCommand("autoComplete_get_books", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@searchPattern", SqlDbType.NVarChar) { Value = @searchPattern });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class AutoComplete
            {
                public const string GetBooks = "autoComplete_get_books";
            }
        }
        public static partial class AutoComplete
        {

            public static SqlCommand GetCategories(SqlConnection conn, string @searchPattern)
            {
                var cmd = new SqlCommand("autoComplete_get_categories", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@searchPattern", SqlDbType.NVarChar) { Value = @searchPattern });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class AutoComplete
            {
                public const string GetCategories = "autoComplete_get_categories";
            }
        }
        public static partial class AutoComplete
        {

            public static SqlCommand GetUsersEmails(SqlConnection conn, string @searchPattern)
            {
                var cmd = new SqlCommand("autoComplete_get_users_emails", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@searchPattern", SqlDbType.NVarChar) { Value = @searchPattern });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class AutoComplete
            {
                public const string GetUsersEmails = "autoComplete_get_users_emails";
            }
        }
        public static partial class Books
        {

            public static SqlCommand ByCategory(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, int? @categoryId)
            {
                var cmd = new SqlCommand("books_by_category", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@categoryId", SqlDbType.Int) { Value = @categoryId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string ByCategory = "books_by_category";
            }
        }
        public static partial class Books
        {

            public static SqlCommand Delete(SqlConnection conn, int? @bookId)
            {
                var cmd = new SqlCommand("books_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string Delete = "books_delete";
            }
        }
        public static partial class Books
        {

            public static SqlCommand GetBest(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("books_get_best", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string GetBest = "books_get_best";
            }
        }
        public static partial class Books
        {

            public static SqlCommand GetBooksByCategory(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, int? @categoryId, int? @userId)
            {
                var cmd = new SqlCommand("books_get_books_by_category", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@categoryId", SqlDbType.Int) { Value = @categoryId });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string GetBooksByCategory = "books_get_books_by_category";
            }
        }
        public static partial class Books
        {

            public static SqlCommand GetByAuthor(SqlConnection conn, int? @authorId)
            {
                var cmd = new SqlCommand("books_get_by_author", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@authorId", SqlDbType.Int) { Value = @authorId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string GetByAuthor = "books_get_by_author";
            }
        }
        public static partial class Books
        {

            public static SqlCommand GetListing(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, string @name, int? @authorId, int? @categoryId)
            {
                var cmd = new SqlCommand("books_get_listing", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar) { Value = @name });
                cmd.Parameters.Add(new SqlParameter("@authorId", SqlDbType.Int) { Value = @authorId });
                cmd.Parameters.Add(new SqlParameter("@categoryId", SqlDbType.Int) { Value = @categoryId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string GetListing = "books_get_listing";
            }
        }
        public static partial class Books
        {

            public static SqlCommand GetNewBooks(SqlConnection conn)
            {
                var cmd = new SqlCommand("books_get_new_books", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string GetNewBooks = "books_get_new_books";
            }
        }
        public static partial class Books
        {

            public static SqlCommand GetProfileRatedBooksByLoginOrEmail(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, string @email, int? @currentUserId)
            {
                var cmd = new SqlCommand("books_get_profile_rated_books_by_login_or_email", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@currentUserId", SqlDbType.Int) { Value = @currentUserId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string GetProfileRatedBooksByLoginOrEmail = "books_get_profile_rated_books_by_login_or_email";
            }
        }
        public static partial class Books
        {

            public static SqlCommand GetRatedBooks(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("books_get_rated_books", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string GetRatedBooks = "books_get_rated_books";
            }
        }
        public static partial class Books
        {

            /// <summary>
            /// Other parameters: @authors: list_author|@categories: list_category
            /// </summary>
            public static SqlCommand Insert(SqlConnection conn, System.DateTime? @dateOfPublish, string @shortContent, string @title, string @avatar, string @fileName, int? @userId)
            {
                var cmd = new SqlCommand("books_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@dateOfPublish", SqlDbType.Date) { Value = @dateOfPublish });
                cmd.Parameters.Add(new SqlParameter("@shortContent", SqlDbType.NVarChar) { Value = @shortContent });
                cmd.Parameters.Add(new SqlParameter("@title", SqlDbType.NVarChar) { Value = @title });
                cmd.Parameters.Add(new SqlParameter("@avatar", SqlDbType.NVarChar) { Value = @avatar });
                cmd.Parameters.Add(new SqlParameter("@fileName", SqlDbType.NVarChar) { Value = @fileName });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string Insert = "books_insert";
            }
        }
        public static partial class Books
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("books_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string SelectAll = "books_select_all";
            }
        }
        public static partial class Books
        {

            public static SqlCommand SelectByAuthor(SqlConnection conn, int? @authorId)
            {
                var cmd = new SqlCommand("books_select_by_author", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@authorId", SqlDbType.Int) { Value = @authorId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string SelectByAuthor = "books_select_by_author";
            }
        }
        public static partial class Books
        {

            public static SqlCommand SelectById(SqlConnection conn, int? @bookId)
            {
                var cmd = new SqlCommand("books_select_by_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string SelectById = "books_select_by_id";
            }
        }
        public static partial class Books
        {

            /// <summary>
            /// Other parameters: @authors: list_author|@categories: list_category
            /// </summary>
            public static SqlCommand Update(SqlConnection conn, int? @bookId, System.DateTime? @dateOfPublish, string @shortContent, string @title, string @avatar, string @fileName, int? @userId)
            {
                var cmd = new SqlCommand("books_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });
                cmd.Parameters.Add(new SqlParameter("@dateOfPublish", SqlDbType.Date) { Value = @dateOfPublish });
                cmd.Parameters.Add(new SqlParameter("@shortContent", SqlDbType.NVarChar) { Value = @shortContent });
                cmd.Parameters.Add(new SqlParameter("@title", SqlDbType.NVarChar) { Value = @title });
                cmd.Parameters.Add(new SqlParameter("@avatar", SqlDbType.NVarChar) { Value = @avatar });
                cmd.Parameters.Add(new SqlParameter("@fileName", SqlDbType.NVarChar) { Value = @fileName });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string Update = "books_update";
            }
        }
        public static partial class Books
        {

            public static SqlCommand Validate(SqlConnection conn, int? @bookId, string @name, string @authorsList)
            {
                var cmd = new SqlCommand("books_validate", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });
                cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar) { Value = @name });
                cmd.Parameters.Add(new SqlParameter("@authorsList", SqlDbType.NVarChar) { Value = @authorsList });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Books
            {
                public const string Validate = "books_validate";
            }
        }
        public static partial class Categories
        {

            public static SqlCommand Delete(SqlConnection conn, int? @categoryId)
            {
                var cmd = new SqlCommand("categories_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@categoryId", SqlDbType.Int) { Value = @categoryId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Categories
            {
                public const string Delete = "categories_delete";
            }
        }
        public static partial class Categories
        {

            public static SqlCommand GetListing(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, string @name)
            {
                var cmd = new SqlCommand("categories_get_listing", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar) { Value = @name });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Categories
            {
                public const string GetListing = "categories_get_listing";
            }
        }
        public static partial class Categories
        {

            public static SqlCommand Insert(SqlConnection conn, string @name, int? @parentId)
            {
                var cmd = new SqlCommand("categories_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar) { Value = @name });
                cmd.Parameters.Add(new SqlParameter("@parentId", SqlDbType.Int) { Value = @parentId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Categories
            {
                public const string Insert = "categories_insert";
            }
        }
        public static partial class Categories
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("categories_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Categories
            {
                public const string SelectAll = "categories_select_all";
            }
        }
        public static partial class Categories
        {

            public static SqlCommand SelectById(SqlConnection conn, int? @categoryId)
            {
                var cmd = new SqlCommand("categories_select_by_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@categoryId", SqlDbType.Int) { Value = @categoryId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Categories
            {
                public const string SelectById = "categories_select_by_id";
            }
        }
        public static partial class Categories
        {

            public static SqlCommand Update(SqlConnection conn, int? @categoryId, string @name, int? @parentId)
            {
                var cmd = new SqlCommand("categories_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@categoryId", SqlDbType.Int) { Value = @categoryId });
                cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar) { Value = @name });
                cmd.Parameters.Add(new SqlParameter("@parentId", SqlDbType.Int) { Value = @parentId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Categories
            {
                public const string Update = "categories_update";
            }
        }
        public static partial class Categories
        {

            public static SqlCommand Validate(SqlConnection conn, int? @categoryId, string @name)
            {
                var cmd = new SqlCommand("categories_validate", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@categoryId", SqlDbType.Int) { Value = @categoryId });
                cmd.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar) { Value = @name });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Categories
            {
                public const string Validate = "categories_validate";
            }
        }
        public static partial class Comments
        {

            public static SqlCommand Delete(SqlConnection conn, int? @commentId)
            {
                var cmd = new SqlCommand("comments_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@commentId", SqlDbType.Int) { Value = @commentId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Comments
            {
                public const string Delete = "comments_delete";
            }
        }
        public static partial class Comments
        {

            public static SqlCommand GetByResponse(SqlConnection conn, int? @responseId)
            {
                var cmd = new SqlCommand("comments_get_by_response", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@responseId", SqlDbType.Int) { Value = @responseId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Comments
            {
                public const string GetByResponse = "comments_get_by_response";
            }
        }
        public static partial class Comments
        {

            public static SqlCommand GetListing(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, string @description, System.DateTime? @dateOfPublish, int? @userId, int? @responseId)
            {
                var cmd = new SqlCommand("comments_get_listing", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@description", SqlDbType.NVarChar) { Value = @description });
                cmd.Parameters.Add(new SqlParameter("@dateOfPublish", SqlDbType.DateTime) { Value = @dateOfPublish });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@responseId", SqlDbType.Int) { Value = @responseId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Comments
            {
                public const string GetListing = "comments_get_listing";
            }
        }
        public static partial class Comments
        {

            public static SqlCommand Insert(SqlConnection conn, string @description, System.DateTime? @dateOfPublish, int? @userId, int? @responseId)
            {
                var cmd = new SqlCommand("comments_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@description", SqlDbType.NVarChar) { Value = @description });
                cmd.Parameters.Add(new SqlParameter("@dateOfPublish", SqlDbType.DateTime) { Value = @dateOfPublish });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@responseId", SqlDbType.Int) { Value = @responseId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Comments
            {
                public const string Insert = "comments_insert";
            }
        }
        public static partial class Comments
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("comments_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Comments
            {
                public const string SelectAll = "comments_select_all";
            }
        }
        public static partial class Comments
        {

            public static SqlCommand SelectById(SqlConnection conn, int? @commentId)
            {
                var cmd = new SqlCommand("comments_select_by_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@commentId", SqlDbType.Int) { Value = @commentId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Comments
            {
                public const string SelectById = "comments_select_by_id";
            }
        }
        public static partial class Comments
        {

            public static SqlCommand Update(SqlConnection conn, int? @commentId, string @description, System.DateTime? @dateOfPublish, int? @userId, int? @responseId)
            {
                var cmd = new SqlCommand("comments_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@commentId", SqlDbType.Int) { Value = @commentId });
                cmd.Parameters.Add(new SqlParameter("@description", SqlDbType.NVarChar) { Value = @description });
                cmd.Parameters.Add(new SqlParameter("@dateOfPublish", SqlDbType.DateTime) { Value = @dateOfPublish });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@responseId", SqlDbType.Int) { Value = @responseId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Comments
            {
                public const string Update = "comments_update";
            }
        }
        public static partial class Friend
        {

            public static SqlCommand GetLising(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("friend_get_lising", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friend
            {
                public const string GetLising = "friend_get_lising";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand ByUserId(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("friends_by_userId", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string ByUserId = "friends_by_userId";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand Delete(SqlConnection conn, int? @friendId, int? @userId)
            {
                var cmd = new SqlCommand("friends_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@friendId", SqlDbType.Int) { Value = @friendId });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string Delete = "friends_delete";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand GetAll(SqlConnection conn, int? @userId, int? @page, int? @size, string @column, int? @direction, string @email, string @login)
            {
                var cmd = new SqlCommand("friends_get_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string GetAll = "friends_get_all";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand GetByUserId(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("friends_get_by_userId", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string GetByUserId = "friends_get_by_userId";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand GetLising(SqlConnection conn, int? @userId, int? @page, int? @size, string @column, int? @direction, string @email, string @login)
            {
                var cmd = new SqlCommand("friends_get_lising", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string GetLising = "friends_get_lising";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand GetRequest(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("friends_get_request", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string GetRequest = "friends_get_request";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand Insert(SqlConnection conn, int? @userId, int? @friendId, bool @isAccepted)
            {
                var cmd = new SqlCommand("friends_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@friendId", SqlDbType.Int) { Value = @friendId });
                cmd.Parameters.Add(new SqlParameter("@isAccepted", SqlDbType.Binary) { Value = @isAccepted });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string Insert = "friends_insert";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand IsFriend(SqlConnection conn, int? @userId, int? @friendId)
            {
                var cmd = new SqlCommand("friends_is_friend", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@friendId", SqlDbType.Int) { Value = @friendId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string IsFriend = "friends_is_friend";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand Set(SqlConnection conn, int? @userId, int? @friendId)
            {
                var cmd = new SqlCommand("friends_set", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@friendId", SqlDbType.Int) { Value = @friendId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string Set = "friends_set";
            }
        }
        public static partial class Friends
        {

            public static SqlCommand Update(SqlConnection conn, int? @userId, int? @friendId, bool @isAccepted)
            {
                var cmd = new SqlCommand("friends_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@friendId", SqlDbType.Int) { Value = @friendId });
                cmd.Parameters.Add(new SqlParameter("@isAccepted", SqlDbType.Binary) { Value = @isAccepted });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Friends
            {
                public const string Update = "friends_update";
            }
        }
        public static partial class Get
        {

            public static SqlCommand AuthorsByLetter(SqlConnection conn, string @letter)
            {
                var cmd = new SqlCommand("get_authors_by_letter", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@letter", SqlDbType.NVarChar) { Value = @letter });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Get
            {
                public const string AuthorsByLetter = "get_authors_by_letter";
            }
        }
        public static partial class Message
        {

            public static SqlCommand Delete(SqlConnection conn, int? @messageId)
            {
                var cmd = new SqlCommand("message_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@messageId", SqlDbType.Int) { Value = @messageId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string Delete = "message_delete";
            }
        }
        public static partial class Message
        {

            public static SqlCommand GetListing(SqlConnection conn, int? @recepientId, int? @senderId, int? @page, int? @size)
            {
                var cmd = new SqlCommand("message_get_listing", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@recepientId", SqlDbType.Int) { Value = @recepientId });
                cmd.Parameters.Add(new SqlParameter("@senderId", SqlDbType.Int) { Value = @senderId });
                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string GetListing = "message_get_listing";
            }
        }
        public static partial class Message
        {

            public static SqlCommand GetNotRead(SqlConnection conn, int? @senderId, int? @recipientId, System.DateTime?@dateOfRead)
            {
                var cmd = new SqlCommand("message_get_not_read", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@senderId", SqlDbType.Int) { Value = @senderId });
                cmd.Parameters.Add(new SqlParameter("@recipientId", SqlDbType.Int) { Value = @recipientId });
                cmd.Parameters.Add(new SqlParameter("@dateOfRead", SqlDbType.DateTime2) { Value = @dateOfRead });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string GetNotRead = "message_get_not_read";
            }
        }
        public static partial class Message
        {

            public static SqlCommand Insert(SqlConnection conn, System.DateTime?@dateOfRead, System.DateTime?@dateOfSend, string @message, int? @recipientId, int? @senderId)
            {
                var cmd = new SqlCommand("message_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@dateOfRead", SqlDbType.DateTime2) { Value = @dateOfRead });
                cmd.Parameters.Add(new SqlParameter("@dateOfSend", SqlDbType.DateTime2) { Value = @dateOfSend });
                cmd.Parameters.Add(new SqlParameter("@message", SqlDbType.NVarChar) { Value = @message });
                cmd.Parameters.Add(new SqlParameter("@recipientId", SqlDbType.Int) { Value = @recipientId });
                cmd.Parameters.Add(new SqlParameter("@senderId", SqlDbType.Int) { Value = @senderId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string Insert = "message_insert";
            }
        }
        public static partial class Message
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("message_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string SelectAll = "message_select_all";
            }
        }
        public static partial class Message
        {

            public static SqlCommand SelectById(SqlConnection conn, int? @messageId)
            {
                var cmd = new SqlCommand("message_select_by_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@messageId", SqlDbType.Int) { Value = @messageId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string SelectById = "message_select_by_id";
            }
        }
        public static partial class Message
        {

            public static SqlCommand SelectByUser(SqlConnection conn, int? @userId, int? @page, int? @size, string @column, int? @direction, string @login)
            {
                var cmd = new SqlCommand("message_select_by_user", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string SelectByUser = "message_select_by_user";
            }
        }
        public static partial class Message
        {

            public static SqlCommand SetNotRead(SqlConnection conn, int? @senderId, int? @recipientId, System.DateTime?@dateOfRead)
            {
                var cmd = new SqlCommand("message_set_not_read", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@senderId", SqlDbType.Int) { Value = @senderId });
                cmd.Parameters.Add(new SqlParameter("@recipientId", SqlDbType.Int) { Value = @recipientId });
                cmd.Parameters.Add(new SqlParameter("@dateOfRead", SqlDbType.DateTime2) { Value = @dateOfRead });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string SetNotRead = "message_set_not_read";
            }
        }
        public static partial class Message
        {

            public static SqlCommand Update(SqlConnection conn, int? @messageId, System.DateTime? @dateOfRead, System.DateTime? @dateOfSend, string @message, int? @recipientId, int? @senderId)
            {
                var cmd = new SqlCommand("message_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@messageId", SqlDbType.Int) { Value = @messageId });
                cmd.Parameters.Add(new SqlParameter("@dateOfRead", SqlDbType.DateTime) { Value = @dateOfRead });
                cmd.Parameters.Add(new SqlParameter("@dateOfSend", SqlDbType.DateTime) { Value = @dateOfSend });
                cmd.Parameters.Add(new SqlParameter("@message", SqlDbType.NVarChar) { Value = @message });
                cmd.Parameters.Add(new SqlParameter("@recipientId", SqlDbType.Int) { Value = @recipientId });
                cmd.Parameters.Add(new SqlParameter("@senderId", SqlDbType.Int) { Value = @senderId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Message
            {
                public const string Update = "message_update";
            }
        }
        public static partial class Messages
        {

            public static SqlCommand GetNotRead(SqlConnection conn, int? @senderId, int? @recipientId, System.DateTime?@dateOfRead)
            {
                var cmd = new SqlCommand("messages_get_not_read", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@senderId", SqlDbType.Int) { Value = @senderId });
                cmd.Parameters.Add(new SqlParameter("@recipientId", SqlDbType.Int) { Value = @recipientId });
                cmd.Parameters.Add(new SqlParameter("@dateOfRead", SqlDbType.DateTime2) { Value = @dateOfRead });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Messages
            {
                public const string GetNotRead = "messages_get_not_read";
            }
        }
        public static partial class Ratings
        {

            public static SqlCommand GetBookRating(SqlConnection conn, int? @bookId, int? @userId)
            {
                var cmd = new SqlCommand("ratings_get_book_rating", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Ratings
            {
                public const string GetBookRating = "ratings_get_book_rating";
            }
        }
        public static partial class Ratings
        {

            public static SqlCommand Insert(SqlConnection conn, int? @userId, int? @bookId, int? @rateValue)
            {
                var cmd = new SqlCommand("ratings_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });
                cmd.Parameters.Add(new SqlParameter("@rateValue", SqlDbType.Int) { Value = @rateValue });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Ratings
            {
                public const string Insert = "ratings_insert";
            }
        }
        public static partial class Responses
        {

            public static SqlCommand Delete(SqlConnection conn, int? @responseId)
            {
                var cmd = new SqlCommand("responses_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@responseId", SqlDbType.Int) { Value = @responseId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Responses
            {
                public const string Delete = "responses_delete";
            }
        }
        public static partial class Responses
        {

            public static SqlCommand GetByBook(SqlConnection conn, int? @bookId)
            {
                var cmd = new SqlCommand("responses_get_by_book", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Responses
            {
                public const string GetByBook = "responses_get_by_book";
            }
        }
        public static partial class Responses
        {

            public static SqlCommand GetListing(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, int? @bookId, int? @userId, System.DateTime?@dateFrom, System.DateTime?@dateTo)
            {
                var cmd = new SqlCommand("responses_get_listing", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@dateFrom", SqlDbType.DateTime2) { Value = @dateFrom });
                cmd.Parameters.Add(new SqlParameter("@dateTo", SqlDbType.DateTime2) { Value = @dateTo });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Responses
            {
                public const string GetListing = "responses_get_listing";
            }
        }
        public static partial class Responses
        {

            public static SqlCommand GetShortByBook(SqlConnection conn, int? @bookId)
            {
                var cmd = new SqlCommand("responses_get_short_by_book", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Responses
            {
                public const string GetShortByBook = "responses_get_short_by_book";
            }
        }
        public static partial class Responses
        {

            public static SqlCommand Insert(SqlConnection conn, int? @bookId, string @content, System.DateTime? @dateOfPublish, int? @userId)
            {
                var cmd = new SqlCommand("responses_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });
                cmd.Parameters.Add(new SqlParameter("@content", SqlDbType.NVarChar) { Value = @content });
                cmd.Parameters.Add(new SqlParameter("@dateOfPublish", SqlDbType.DateTime) { Value = @dateOfPublish });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Responses
            {
                public const string Insert = "responses_insert";
            }
        }
        public static partial class Responses
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("responses_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Responses
            {
                public const string SelectAll = "responses_select_all";
            }
        }
        public static partial class Responses
        {

            public static SqlCommand SelectById(SqlConnection conn, int? @responseId)
            {
                var cmd = new SqlCommand("responses_select_by_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@responseId", SqlDbType.Int) { Value = @responseId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Responses
            {
                public const string SelectById = "responses_select_by_id";
            }
        }
        public static partial class Responses
        {

            public static SqlCommand Update(SqlConnection conn, int? @responseId, int? @bookId, string @description, System.DateTime? @dateOfPublish, int? @userId)
            {
                var cmd = new SqlCommand("responses_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@responseId", SqlDbType.Int) { Value = @responseId });
                cmd.Parameters.Add(new SqlParameter("@bookId", SqlDbType.Int) { Value = @bookId });
                cmd.Parameters.Add(new SqlParameter("@description", SqlDbType.NVarChar) { Value = @description });
                cmd.Parameters.Add(new SqlParameter("@dateOfPublish", SqlDbType.DateTime) { Value = @dateOfPublish });
                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Responses
            {
                public const string Update = "responses_update";
            }
        }
        public static partial class User
        {

            public static SqlCommand ProfileUpdate(SqlConnection conn, int? @userId, string @avatar, string @email, object @password, object @salt, string @login, System.DateTime?@registrationDate, byte? @status, System.DateTime?@lastUpdateDate)
            {
                var cmd = new SqlCommand("user_profile_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@avatar", SqlDbType.NVarChar) { Value = @avatar });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@registrationDate", SqlDbType.DateTime2) { Value = @registrationDate });
                cmd.Parameters.Add(new SqlParameter("@status", SqlDbType.TinyInt) { Value = @status });
                cmd.Parameters.Add(new SqlParameter("@lastUpdateDate", SqlDbType.DateTime2) { Value = @lastUpdateDate });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class User
            {
                public const string ProfileUpdate = "user_profile_update";
            }
        }
        public static partial class Users
        {

            public static SqlCommand Delete(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("users_delete", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string Delete = "users_delete";
            }
        }
        public static partial class Users
        {

            public static SqlCommand GetByEmailOrLogin(SqlConnection conn, string @email)
            {
                var cmd = new SqlCommand("users_get_by_email_or_login", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string GetByEmailOrLogin = "users_get_by_email_or_login";
            }
        }
        public static partial class Users
        {

            public static SqlCommand GetListing(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, string @email, string @login)
            {
                var cmd = new SqlCommand("users_get_listing", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string GetListing = "users_get_listing";
            }
        }
        public static partial class Users
        {

            public static SqlCommand GetProfileRatedBooksByLoginOrEmail(SqlConnection conn, int? @page, int? @size, string @column, int? @direction, string @email)
            {
                var cmd = new SqlCommand("users_get_profile_rated_books_by_login_or_email", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@page", SqlDbType.Int) { Value = @page });
                cmd.Parameters.Add(new SqlParameter("@size", SqlDbType.Int) { Value = @size });
                cmd.Parameters.Add(new SqlParameter("@column", SqlDbType.NVarChar) { Value = @column });
                cmd.Parameters.Add(new SqlParameter("@direction", SqlDbType.Int) { Value = @direction });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string GetProfileRatedBooksByLoginOrEmail = "users_get_profile_rated_books_by_login_or_email";
            }
        }
        public static partial class Users
        {

            public static SqlCommand Insert(SqlConnection conn, string @avatar, string @email, object @password, object @salt, string @login, System.DateTime?@registrationDate, byte? @status, System.DateTime?@lastUpdateDate)
            {
                var cmd = new SqlCommand("users_insert", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@avatar", SqlDbType.NVarChar) { Value = @avatar });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@registrationDate", SqlDbType.DateTime2) { Value = @registrationDate });
                cmd.Parameters.Add(new SqlParameter("@status", SqlDbType.TinyInt) { Value = @status });
                cmd.Parameters.Add(new SqlParameter("@lastUpdateDate", SqlDbType.DateTime2) { Value = @lastUpdateDate });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string Insert = "users_insert";
            }
        }
        public static partial class Users
        {

            public static SqlCommand ProfileUpdate(SqlConnection conn, int? @userId, string @avatar, string @email, object @password, object @salt, string @login, System.DateTime?@registrationDate, byte? @status, System.DateTime?@lastUpdateDate)
            {
                var cmd = new SqlCommand("users_profile_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@avatar", SqlDbType.NVarChar) { Value = @avatar });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@registrationDate", SqlDbType.DateTime2) { Value = @registrationDate });
                cmd.Parameters.Add(new SqlParameter("@status", SqlDbType.TinyInt) { Value = @status });
                cmd.Parameters.Add(new SqlParameter("@lastUpdateDate", SqlDbType.DateTime2) { Value = @lastUpdateDate });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string ProfileUpdate = "users_profile_update";
            }
        }
        public static partial class Users
        {

            public static SqlCommand SelectAll(SqlConnection conn)
            {
                var cmd = new SqlCommand("users_select_all", conn);
                cmd.CommandType = CommandType.StoredProcedure;


                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string SelectAll = "users_select_all";
            }
        }
        public static partial class Users
        {

            public static SqlCommand SelectById(SqlConnection conn, int? @userId)
            {
                var cmd = new SqlCommand("users_select_by_id", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string SelectById = "users_select_by_id";
            }
        }
        public static partial class Users
        {

            public static SqlCommand Update(SqlConnection conn, int? @userId, string @avatar, string @email, object @password, object @salt, string @login, System.DateTime?@registrationDate, byte? @status, System.DateTime?@lastUpdateDate)
            {
                var cmd = new SqlCommand("users_update", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@avatar", SqlDbType.NVarChar) { Value = @avatar });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });
                cmd.Parameters.Add(new SqlParameter("@password", SqlDbType.Binary) { Value = @password });
                cmd.Parameters.Add(new SqlParameter("@salt", SqlDbType.Binary) { Value = @salt });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@registrationDate", SqlDbType.DateTime2) { Value = @registrationDate });
                cmd.Parameters.Add(new SqlParameter("@status", SqlDbType.TinyInt) { Value = @status });
                cmd.Parameters.Add(new SqlParameter("@lastUpdateDate", SqlDbType.DateTime2) { Value = @lastUpdateDate });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string Update = "users_update";
            }
        }
        public static partial class Users
        {

            public static SqlCommand Validate(SqlConnection conn, int? @userId, string @login, string @email)
            {
                var cmd = new SqlCommand("users_validate", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int) { Value = @userId });
                cmd.Parameters.Add(new SqlParameter("@login", SqlDbType.NVarChar) { Value = @login });
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.NVarChar) { Value = @email });

                return cmd;
            }
        }

        public static partial class ProcedureNames
        {
            public static partial class Users
            {
                public const string Validate = "users_validate";
            }
        }
    }
}